/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package wggcth.persistencia.vo;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author deusemar
 */
@Entity
@Table(name = "experimento", catalog = "wggcth", schema = "")
@NamedQueries({@NamedQuery(name = "Experimento.findAll", query = "SELECT e FROM Experimento e"), @NamedQuery(name = "Experimento.findByIdexperimento", query = "SELECT e FROM Experimento e WHERE e.idexperimento = :idexperimento"), @NamedQuery(name = "Experimento.findByNome", query = "SELECT e FROM Experimento e WHERE e.nome = :nome"), @NamedQuery(name = "Experimento.findByDataexperimento", query = "SELECT e FROM Experimento e WHERE e.dataexperimento = :dataexperimento")})
public class Experimento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDEXPERIMENTO", nullable = false)
    private Integer idexperimento;
    @Column(name = "NOME", length = 30)
    private String nome;
    @Column(name = "DATAEXPERIMENTO")
    @Temporal(TemporalType.DATE)
    private Date dataexperimento;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idexperimento")
    private Collection<Amostra> amostraCollection;
    @JoinColumn(name = "IDUSUARIO", referencedColumnName = "IDUSUARIO", nullable = false)
    @ManyToOne(optional = false)
    private Usuario idusuario;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "experimento")
    private Collection<DadosExperimento> dadosExperimentoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idexperimento")
    private Collection<Variavel> variavelCollection;

    public Experimento() {
    }

    public Experimento(Integer idexperimento) {
        this.idexperimento = idexperimento;
    }

    public Integer getIdexperimento() {
        return idexperimento;
    }

    public void setIdexperimento(Integer idexperimento) {
        this.idexperimento = idexperimento;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Date getDataexperimento() {
        return dataexperimento;
    }

    public void setDataexperimento(Date dataexperimento) {
        this.dataexperimento = dataexperimento;
    }

    public Collection<Amostra> getAmostraCollection() {
        return amostraCollection;
    }

    public void setAmostraCollection(Collection<Amostra> amostraCollection) {
        this.amostraCollection = amostraCollection;
    }

    public Usuario getIdusuario() {
        return idusuario;
    }

    public void setIdusuario(Usuario idusuario) {
        this.idusuario = idusuario;
    }

    public Collection<DadosExperimento> getDadosExperimentoCollection() {
        return dadosExperimentoCollection;
    }

    public void setDadosExperimentoCollection(Collection<DadosExperimento> dadosExperimentoCollection) {
        this.dadosExperimentoCollection = dadosExperimentoCollection;
    }

    public Collection<Variavel> getVariavelCollection() {
        return variavelCollection;
    }

    public void setVariavelCollection(Collection<Variavel> variavelCollection) {
        this.variavelCollection = variavelCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idexperimento != null ? idexperimento.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Experimento)) {
            return false;
        }
        Experimento other = (Experimento) object;
        if ((this.idexperimento == null && other.idexperimento != null) || (this.idexperimento != null && !this.idexperimento.equals(other.idexperimento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "wggcth.persistencia.vo.Experimento[idexperimento=" + idexperimento + "]";
    }

}
